<?php

class resize extends Controller {

	function resize()
	{
		parent::Controller();
        $this->load->library('session');
		$this->load->library('form_validation');
		$this->load->library('image_lib');
		$this->load->database('default');
		$this->load->helper(array('form', 'url'));
	}

	function thumb()
	{
		$config['image_library'] = 'gd2';
		$config['source_image'] = $this->data['full_path'];
		$config['new_image'] = $this->image_path;
		$config['create_thumb'] = TRUE;
		$config['maintain_ratio'] = TRUE;
		$config['thumb_marker'] = "";
		$config['width'] = 640;
		$config['height'] = 480;$this->load->library('image_lib',$config);
		$this->image_lib->resize()
		$this->data['full_path'] //is a full path of the of the uploaded image.To Resize the images in multiple sizes we need to use the clear() of image_lib class.
		$this->load->library('image_lib');
		$this->image_lib->clear();
		$this->image_lib->initialize($config);

		if ( ! $this->image_lib->resize())
		{
		echo $this->image_lib->display_errors();
		$this->image_lib->clear();
		return false;
		}

	}

}